let {Service} = require('egg');

class UserService extends Service{
    //注册
    async registry(username,password,phone){
        await this.app.mysql.query('insert into userlist (username,password,phone) values (?,?,?)',[username,password,phone])
    }   
    //排重
    async selectUser(username){
        return await this.app.mysql.query('select * from userlist where username=?',[username])
    }

    //登录
    async login(username,password){
        return await this.app.mysql.query('select * from userlist where username=? and password=?',[username,password])
    }
}


module.exports = UserService